package cn.edu.paisi.controller;

import java.io.IOException;
import java.text.SimpleDateFormat;
import java.util.Date;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.scheduling.annotation.Scheduled;
import org.springframework.stereotype.Controller;

import cn.edu.paisi.util.WebSocketServer;

@Controller
public class ExamController {
	private static Logger log = LoggerFactory.getLogger(ExamController.class);
	
	@Scheduled(cron = "0/1 * * * * ?")
    public void countDown() {
        try {
        	Date date = new Date();
        	SimpleDateFormat dateFormat = new SimpleDateFormat("mm:ss");
            WebSocketServer.sendInfo(dateFormat.format(date),null);
        }catch (IOException e) {
        	log.error(e.getMessage());
        }
    }
	
	//@Scheduled(cron = "30-50 * * * * ?")
	public void timer() {
		log.info("定时器执行...");
	}
}
